<?php

class Skjb_Office_Spreadsheet_Exporter_Excel2007Xml_Workbook
{
    public function toXml()
    {
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->startDocument('1.0', 'UTF-8', 'yes');
        
        $xml->startElement('workbook');
        $xml->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
        $xml->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
        
        $xml->startElement('fileVersion');
        $xml->writeAttribute('appName', 'xl');
        $xml->writeAttribute('lastEdited', '4');
        $xml->writeAttribute('lowestEdited', '4');
        $xml->writeAttribute('rupBuild', '4506');
        $xml->endElement(); // fileVersion
        
        $xml->startElement('workbookPr');
        $xml->writeAttribute('defaultThemeVersion', '124226');
        $xml->endElement(); // workbookPr
        
        $xml->startElement('bookViews');
        
        $xml->startElement('workbookView');
        $xml->writeAttribute('xWindow', '0');
        $xml->writeAttribute('yWindow', '90');
        $xml->writeAttribute('windowWidth', '28755');
        $xml->writeAttribute('windowHeight', '12585');
        $xml->endElement(); // workbookView
        
        $xml->endElement(); // bookViews
        
        $xml->startElement('sheets');
        
        $xml->startElement('sheet');
        $xml->writeAttribute('name', 'Sheet1');
        $xml->writeAttribute('sheetId', '1');
        $xml->writeAttribute('r:id', 'rId1');
        $xml->endElement(); // sheet
        
        $xml->endElement(); // sheets
        
        $xml->startElement('calcPr');
        $xml->writeAttribute('calcId', '125725');
        $xml->endElement(); // calcPr
        
        $xml->endElement(); // workbook
        
        $xml->endDocument();
        
        return $xml->outputMemory();
    }
}
